package ua.kpi_java_training.evgeniygusar.module2.tests;

import org.junit.Test;
import ua.kpi_java_training.evgeniygusar.module2.*;

import java.util.ArrayList;

public class PredatorTest {
    static Predator p = new Predator();
    AllVictims victimsObject = new AllVictims();


    @Test
    public void testMoving() throws Exception {
        victimsObject.addVictim();
        victimsObject.getVictim(0).x = 7;
        victimsObject.getVictim(0).y = 7;
        p.x = 6;
        p.y = 5;
        p.Moving();
        assert((7==p.x)&(7==p.y));
    }

    @Test
    public void testCheckVictimIsEated() throws Exception {
        victimsObject.addVictim();
        victimsObject.getVictim(0).x = 7;
        victimsObject.getVictim(0).y = 7;
        p.x = 7;
        p.y = 7;
        victimsObject.nearestVictim(p.x, p.y);
        p.x_of_nearest_victim = victimsObject.getXOfNearestVictim();
        p.y_of_nearest_victim = victimsObject.getYOfNearestVictim();
        p.checkVictimIsEated();
        System.out.println(victimsObject.numbersOfVictims());
        assert(0==victimsObject.numbersOfVictims());
    }

    @Test
    public void testStepX() throws Exception {
        p.x_of_nearest_victim = 5;
        p.x = 6;
        p.stepX();
        assert(5==p.x);
    }

    @Test
    public void testStepY() throws Exception {
        p.y_of_nearest_victim = 5;
        p.y = 6;
        p.stepY();
        assert(5==p.y);
    }
}
